<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<!--[if IE 7]>
			<script type='text/javascript' src='js/excanvas.js'></script>
			<link rel="stylesheet" href="css/iefix.css" type="text/css" media="screen" />
		<![endif]-->
		<!--[if IE 8]>
			<script type='text/javascript' src='js/excanvas.js'></script>
			<link rel="stylesheet" href="css/iefix.css" type="text/css" media="screen" />
		<![endif]-->
		<script src="js/jutils.min.js"></script>
		<script src="js/vue2.4.0.js"></script>
		<script src="js/axios.min.js"></script>
		<script src="js/jquery-2.2.3.min.js"></script>
		<script src="js/main.js"></script>
		<script src="js/ajaxfileupload.js"></script>
		<script src="js/mouseMenu.js"></script>
		<script src="js/bootstrap.min.js"></script>
		<link href="css/bootstrap.min.css" type="text/css" rel="stylesheet" />
		<style>
			@media (min-width: 992px) {
				.my-foot span {
					font-size:28px;
					
				}
				#myscroll{
					height: 300px;
				}
			}
			@media (max-width: 400px) {
				.dropdown-menu{
					left: -100px;
				}
				#myscroll{
					height: 150px;
				}
			}
		</style>
	</head>
	<body style="height: 100%;">
		<div id="app">
			<div>
				<nav id="nav-head" class="navbar navbar-default navbar-fixed-top" style="background-color: rgba(255,255,255,1);border: none;">
					<div class="container" style="margin-top: 20px;height: 100%;">
						<div class="jumbotron" style="background-color: #428bca;">
						  <h1 v-text="userName || 佚名"></h1>
						  <p v-text="phone || ''"></p>
						</div>
					</div>
				</nav>
				
			
				<div id="dataTable" class="container" style="height: 100%;margin-top: 300px;">
					<div class="list-group">
					  <a href="#" class="list-group-item active">
					    信息维护
					  </a>
					  <a href="#" data-toggle="modal" data-target="#exampleModal" class="list-group-item">修改密码</a>
					  <a href="#" data-toggle="modal" data-target="#exampleModal2" class="list-group-item">更换电话号码</a>
					  <!-- <a href="#" class="list-group-item">操作记录</a> -->
					  <a href="#" @click="logout()" class="list-group-item">退出</a>
					</div>
				</div>
			</div>
			
			<!--修改密码-->
			<div class="modal fade mod" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
			    <div class="modal-dialog" role="document">
			        <div class="modal-content">
			            <div class="modal-header">
			                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
			                        aria-hidden="true">×</span></button>
			                <h4 class="modal-title" id="exampleModalLabel">修改密码</h4>
			            </div>
			            <div class="modal-body">
			                <form>
			                    <div class="form-group">
			                        <label for="recipient-name" class="control-label">旧密码:</label>
			                        <input type="password" class="form-control" v-model="oldPassword" placeholder="字母开头,6-18个字符" >
			                    </div>
								<div class="form-group">
								    <label for="recipient-name" class="control-label">新密码	:</label>
								    <input type="password" class="form-control" v-model="newPassword" placeholder="字母开头,6-18个字符" >
								</div>
			                </form>
			            </div>
			            <div class="modal-footer">
			                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
			                <button type="button" class="btn btn-primary" @click="rePassWord()">确定</button>
			            </div>
			        </div>
			    </div>
			</div>
			
			<!--修改手机-->
			<div class="modal fade mod" id="exampleModal2" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel2">
			    <div class="modal-dialog" role="document">
			        <div class="modal-content">
			            <div class="modal-header">
			                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
			                        aria-hidden="true">×</span></button>
			                <h4 class="modal-title" id="exampleModalLabel2">修改手机</h4>
			            </div>
			            <div class="modal-body">
			                <form>
			                    <div class="form-group">
			                        <label for="recipient-name" class="control-label">密码:</label>
			                        <input type="password" class="form-control" v-model="oldPassword" placeholder="字母开头,6-18个字符" >
			                    </div>
								<div class="form-group">
								    <label for="recipient-name" class="control-label">手机号码:</label>
								    <input type="text" class="form-control" v-model="inputPhone" placeholder="11位有效手机号码" >
								</div>
			                </form>
			            </div>
			            <div class="modal-footer">
			                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
			                <button type="button" class="btn btn-primary" @click="rePhone()">确定</button>
			            </div>
			        </div>
			    </div>
			</div>
		
		</div>
		
			
		<nav class="navbar navbar-default navbar-fixed-bottom" style="background-color: rgba(255,255,255,0.1);border: none;">
			<iframe src="user_public.html" name="menuFrame" id="menuFrame" onload="reinitIframe()" style="overflow:visible;"
			   	scrolling="no" height="100%" width="100%" frameborder="0">
			</iframe>
		</nav>
		
		<script>
			//ifame 高度因内容自适应
		    window.onresize = function () {
		            reinitIframe();
		        }
		        function reinitIframe(){
		            var iframe = document.getElementById("menuFrame");
		            try{
		                var bHeight = iframe.contentWindow.document.body.scrollHeight;
		                var dHeight = iframe.contentWindow.document.documentElement.scrollHeight;
		                var height = Math.min(bHeight, dHeight);
		                iframe.height = height;
		                // console.log(iframe.height);
		            }catch (ex){}
		        }
		        // 定时触发
		        window.setInterval("reinitIframe()", 200);
		</script>
		
	</body>
</html>
<script>
	//排序方法
	var compare = function (obj1, obj2) {
    var val1 = obj1.name;
    var val2 = obj2.name;
    if (val1 < val2) {
        return -1;
    } else if (val1 > val2) {
        return 1;
    } else {
        return 0;
    }            
} 
	
	var vm =  new Vue({
		el:"#app",
		data:{
			list: 
					[
						//{id:1,name:'1111111111111111111111111',size:'20kb',time:null,filestatus:1,isFile:false},
						//{id:2,name:'b',size:'20kb',time:getMyDate(new Date()),filestatus:1,isFile:false},
						//{id:3,name:'a',size:'20kb',time:getMyDate(new Date()),filestatus:1,isFile:false},
						//{id:4,name:'4',size:'20kb',time:getMyDate(new Date()),filestatus:1,isFile:true},
						//{id:5,name:'5',size:'20kb',time:getMyDate(new Date()),filestatus:2,isFile:true},
						//{id:6,name:'c',size:'20kb',time:getMyDate(new Date()),filestatus:1,isFile:true},
						//{id:7,name:'7',size:'20kb',time:getMyDate(new Date()),filestatus:1,isFile:true},
						//{id:8,name:'d',size:'20kb',time:getMyDate(new Date()),filestatus:1,isFile:true},
						//{id:9,name:'9',size:'20kb',time:getMyDate(new Date()),filestatus:1,isFile:true}
					]
					,
			g_check: false,
			check: [],
			index: -1,
			oldName:'',
			keys: '',
			newDir:'',
			UserID:null,
			oldDirId:[],
			
			
			userId: null,
			userName: null,
			phone: null,
			
			oldPassword: null,
			newPassword: null,
			inputPhone: null,
		},
		methods:{
			getRoot: function(userId){
				var _this = this;
				//查询用户root目录id
				$.ajax({
		             type: "POST",
		             url: ___Path +  "/user/query.json",
		             data: JSON.stringify({'info':{'objCode':4},'obj':{'userId':userId,'dirName':'我的文件'}}),
		             contentType: "application/json",
		             dataType: "json",
		             success: function(data){
		            	 var dir = data.data.list[0];
		            	 	_this.oldDirId.push({id:dir.id,pId:dir.dirParentId,name:dir.DirName,isFile:false,path:dir.dirPath});
		            	 	_this.getFD(data.data.list[0].id,2);
		             }
		         });
			},
			
			getFD: function(dirId,type){
				var _this = this;
				var dir = null;
				//得到需要需要进入目录的信息
				_this.list.some((item,i) => {
					if(dirId == item.id){
						dir = item;
						return true;
					}
				});
				
				//前进后退模式 1 0
				if(type == 1){
					_this.oldDirId.push(dir);
				}else if(type == 0){
					_this.oldDirId.splice(_this.oldDirId.length-1,1);
				}
				
				//更改当前父目录
				
				//查询用户目录下的文件与目录
				$.ajax({
		             type: "POST",
		             url: ___Path +  "/user/queryFD.json",
		             dataType: "json",
		             data: JSON.stringify({'dirId':dirId}),
		             contentType: "application/json",
		             success: function(data){
		            	var listData = data.data.list;
						for(let i in listData) {
							if(listData[i].time) {
								listData[i].time = jutils.formatDate(new Date(listData[i].time),"YYYY-MM-DD HH:ii:ss");
							}
							if(listData[i].size) {
								listData[i].size = convertFileSize(listData[i].size)
							}
						}
						_this.list = listData;
	                }
		         });

			},
			
			rePhone: function() {
				let t = this
					let le = /^[a-zA-Z]\w{5,17}$/;
					var le2 = /^13(\d{9})$|^15(\d{9})$|^189(\d{8})$/
					if(!t.oldPassword || t.oldPassword === '') {
						alert('请填写密码')
						return
					}
				
					if(!t.inputPhone || t.inputPhone === '') {
						alert('请填写新号码')
						return
					}
					if(!le2.test(t.inputPhone)) {
						alert('新号码格式有误')
						return
					}
					//查询用户旧密码
					$.ajax({
					     type: "POST",
					     url: ___Path +  "/user/query.json",
					     data: JSON.stringify({'info':{'objCode':1},'obj':{'id': t.userId}}),
					     contentType: "application/json",
					     dataType: "json",
					     success: function(data){
							let user = data.data.list[0]
							if(user.password === t.oldPassword) {
								$.ajax({
								     type: "POST",
								     url: ___Path +  "/user/query.json",
								     data: JSON.stringify({'info':{'objCode':1},'obj':{'phone': t.inputPhone}}),
								     contentType: "application/json",
								     dataType: "json",
								     success: function(data){
										let userList = data.data.list
										if(userList.length === 0) {
											$.ajax({
											     type: "POST",
											     url: ___Path +  "/user/update.json",
											     data: JSON.stringify({'info':{'objCode': 1},'obj': {phone: t.inputPhone, id: t.userId}}),
											     contentType: "application/json",
											     dataType: "json",
											     success: function(data){
											    	 if(data.data.count > 0){
											        	$('#exampleModal2').modal('hide');
														t.phone = t.inputPhone
														t.setCookie("phone",t.inputPhone,1);
														t.oldPassword = null
														t.inputPhone = null
											    		 alert("修改成功");
											    	 }else{
														 t.oldPassword = null
														 t.inputPhone = null
											    	 	alert("修改失败");
											    	 }
											     },
											     error: function(error){
													 console.log(error)
											    	 alert("修改失败");
											     }
											 });
										} else if(userList[0].id === t.userId) {
											alert('此电话已绑定本账户')
										} else {
											alert('此电话已绑定其他账户')
										}
									}
								});
							} else {
								alert('旧密码错误，请重新输入或联系管理员')
							}
					     },
					     error: function(error){
							 console.log(error)
					    	 alert("修改失败");
					     }
					 });
				},
			
			rePassWord: function() {
				let t = this
				let le = /^[a-zA-Z]\w{5,17}$/;
				if(!t.oldPassword || t.oldPassword === '') {
					alert('请填写旧密码')
					return
				}
				if(!le.test(t.oldPassword)) {
					alert('旧密码格式有误')
					return
				}
				if(!t.newPassword || t.newPassword === '') {
					alert('请填写新密码')
					return
				}
				if(!le.test(t.newPassword)) {
					alert('新密码格式有误')
					return
				}
				//查询用户旧密码
				$.ajax({
				     type: "POST",
				     url: ___Path +  "/user/query.json",
				     data: JSON.stringify({'info':{'objCode':1},'obj':{'id': t.userId}}),
				     contentType: "application/json",
				     dataType: "json",
				     success: function(data){
						let user = data.data.list[0]
						if(user.password === t.oldPassword) {
							$.ajax({
							     type: "POST",
							     url: ___Path +  "/user/update.json",
							     data: JSON.stringify({'info':{'objCode': 1},'obj': {password: t.newPassword, id: t.userId}}),
							     contentType: "application/json",
							     dataType: "json",
							     success: function(data){
							    	 if(data.data.count > 0){
							        	$('#exampleModal').modal('hide');
							    		 alert("修改成功");
										 t.logout()
							    	 }else{
										 t.oldPassword = null
										 t.newPassword = null
							    	 	alert("修改失败");
							    	 }
							     },
							     error: function(error){
									 console.log(error)
							    	 alert("修改失败");
							     }
							 });
						} else {
							alert('旧密码错误，请重新输入或联系管理员')
						}
				     },
				     error: function(error){
						 console.log(error)
				    	 alert("修改失败");
				     }
				 });
			},
			
			reName: function (){
				var _this = this;
				var type = 0;
				var ii = 0;
				
				_this.list.some((item,i) => {
					if(item.id == _this.index){
						ii = i;
						if(item.isFile){
							type = 3;
						}else{
							type = 4;
						}
						return true;
					}
					
				});
				
					
				var obj = {'id':_this.index-1000,'fileName':_this.oldName};
				if(type == 4){
					obj = {'id':_this.index,'dirName':_this.oldName};
				}
				//
				$.ajax({
		             type: "POST",
		             url: ___Path +  "/user/update.json",
		             data: JSON.stringify({'info':{'objCode':type},'obj':obj}),
		             contentType: "application/json",
		             dataType: "json",
		             success: function(data){
		            	 if(data.data.count > 0){
			            	$('#exampleModal').modal('hide');
			            	_this.list[ii].name = _this.oldName;
		            		 alert("修改成功");
		            	 }else{
		            	 	alert("修改失败");
		            	 }
	                 },
	                 error: function(error){
	                	 alert("修改失败");
	                 }
		         });
			},
			
			getIndex: function(id){
				this.index = id;
			},
			
			checkAll: function(){
				if(this.g_check){
					this.list.some((item,i) => {
						this.check[i] = item.id;
					})
				}else{
					this.check = [];
				}
					
			},
			
			search: function(){
				
				//第二次渲染时去除标签
				let reg = /<\/?.+?\/?>/g;
				this.list.forEach(item => {
					item.name = item.name.replace(reg,'');
				})
				
				//将源数据加入到条件显示数组
				//var newList = [];
				var dirList = [];
				var fileList = [];
				
				for(var i = 0; i < this.list.length; i++){
					//索引代码
					if(this.list[i].name.indexOf(this.keys) != -1){
						if(this.list[i].isFile){
							dirList.push(this.list[i]);
						}else{
							fileList.push(this.list[i]);
						}
					}
				}
				
				//对条件显示数组排序
				dirList.sort(compare);
				fileList.sort(compare);
				
				//拼接数组
				var newList = fileList.concat(dirList);
				//arr.push.apply(arr, arr2);
				//arr.push(...arr2);
				
				//开始渲染加上标签
				if(this.key != ''){
					newList.forEach(item => {
						item.name = item.name.replace(eval("/"+this.keys+"/g"),'<font color=\'red\'><b>' + this.keys + '</b></font>');
					});
				}
				
				
				return newList;
			},
			
			openFile:function(id){
				var _id = id;
				var isF = false;
				var name = "";
				this.list.some((item,i) => {
					if(item.id == _id){
						if(item.isFile){
							_id -= 1000;
							isF = true;
							name = item.name;
						}
						return true;
					}
				});
				
				//判断是否为文件夹
				if(isF){
					//待写
					
					this.download(name)
				}else{
					this.getFD(_id,1);
				}
			},
			
			upLoad: function(){
				let formData=new FormData();
	            formData.append('name',this.name)
	            formData.append('img',this.$refs.file.files[0])
	            this.axios.post('/api/user/query',formData,{
	                'Content-Type':'multipart/form-data'
	            }).then(res=>{
	 
	            });
			},
			
			download: function(name){
				var _this = this;
				let url = ___Path +  "/file/download"
				var form = $("<form>");
					form.attr("style","display:none");
					form.attr("target","");
					form.attr("method","get"); 
					form.attr("action", url);
					var input = $("<input>");
					input.attr("type", "hidden");
					input.attr("name", "path");
					input.attr("value", _this.oldDirId[_this.oldDirId.length-1].path+'/'+name);
					form.append(input);
					$("body").append(form);
					form.submit();
				// window.location.href = ___Path +  "/file/download?path="+_this.oldDirId[_this.oldDirId.length-1].path+'/'+name;
			},
			
			copy: function(){
				
			},
			
			move: function(){
				
			},
			
			//reName: function(){
			//	
			//},
			
			getOldName: function(){
				let reg = /<\/?.+?\/?>/g;
				this.list.some((item,i) => {
					if(item.id == this.index){
						this.oldName = item.name.replace(reg,'');
						return true;
					}
				});
			},
			
			delect: function(){
				var _this = this;
				var type = 4;
				var id = _this.index;
				var ii = 0;
				this.list.some((item,i) => {
					if(item.id == _this.index){
						ii = i;
						if(item.isFile){
							type = 3;
							id -= 1000;
						}
						return true;
					}
				});
				
				
				
				$.ajax({
		             type: "POST",
		             url: ___Path +  "/user/remove.json",
		             data: JSON.stringify({'info':{'objCode':type},'obj':{'ids':[id]}}),
		             contentType: "application/json",
		             dataType: "json",
		             success: function(data){
		            	 if(data.data.count > 0){
		            		 //重新载入当前文件夹
							 _this.list.splice(ii,1);
			            	_this.getFD(_this.oldDirId[_this.oldDirId.length-1].id,2);
		            		 alert("删除成功");
		            	 }else{
		            	 	alert("删除失败");
		            	 }
	                 },
	                 error: function(error){
	                	 alert("删除失败");
	                 }
		         });
				
			},
			
			history: function(){
				
			},
			
			toLove: function(id){
				this.list.some((item,i) => {
					if(item.id == id){
						item.filestatus = item.filestatus==1?2:1;
						return true;
					}
				})
			},
			
			createDir: function(){
				var _this = this;
				$('#exampleModa2').modal('hide')
				var path = _this.oldDirId[_this.oldDirId.length-1].path+'/'+ _this.newDir;
				
				$.ajax({
		             type: "POST",
		             url: ___Path +  "/user/add.json",
		             data: JSON.stringify({'info':{'objCode':4},'obj':{'dirName':_this.newDir,'dirParentId':_this.oldDirId[_this.oldDirId.length-1].id,'userId':_this.UserID,'dirPath':path}}),
		             contentType: "application/json",
		             dataType: "json",
		             success: function(data){
		            	 if(data.data.count > 0){
			            	$('#exampleModal').modal('hide');
			            	_this.getFD(_this.oldDirId[_this.oldDirId.length-1].id,2);
		            		 alert("添加成功");
		            	 }else{
		            	 	alert("添加失败");
		            	 }
	                 },
	                 error: function(error){
	                	 alert("添加失败");
	                 }
		         });
			},
			
			//批量删除
			delSome: function(){
				var _this = this;
				let fileIds = []
				let dirIds = []
				for(let i in this.list) {
					for(let ii in this.check) {
						if(this.list[i].id === this.check[ii]) {
							if(this.list[i].isFile){
								fileIds.push(this.list[i].id - 1000)
							} else {
								dirIds.push(this.list[i].id)
							}
						}
					}
				}
				if(fileIds.length)
				$.ajax({
				     type: "POST",
				     url: ___Path +  "/user/remove.json",
				     data: JSON.stringify({'info':{'objCode':3},'obj':{'ids':fileIds}}),
				     contentType: "application/json",
				     dataType: "json",
				     success: function(data){
				    	 if(data.data.count > 0){
				    		 //重新载入当前文件夹
				        	// _this.list.splice(ii,1);
				        	_this.getFD(_this.oldDirId[_this.oldDirId.length-1].id,2);
				    		 alert("文件删除成功");
				    	 }else{
				    	 	alert("文件删除失败");
				    	 }
				     },
				     error: function(error){
				    	 alert("删除失败");
				     }
				 });
				 if(dirIds.length)
				 $.ajax({
				      type: "POST",
				      url: ___Path +  "/user/remove.json",
				      data: JSON.stringify({'info':{'objCode':4},'obj':{'ids':dirIds}}),
				      contentType: "application/json",
				      dataType: "json",
				      success: function(data){
				     	 if(data.data.count > 0){
				     		 //重新载入当前文件夹
				         	// _this.list.splice(ii,1);
				         	_this.getFD(_this.oldDirId[_this.oldDirId.length-1].id,2);
				     		 alert("文件夹删除成功");
				     	 }else{
				     	 	alert("文件夹删除失败");
				     	 }
				      },
				      error: function(error){
				     	 alert("文件夹删除失败");
				      }
				  });
				this.check = [];
			},
			
			downloadSome: function(){
				if(this.check.length == 0){
					alert("请选择下载项");
					return;
				}
				this.download(this.check);
				this.check = [];
			},
			
			setCookie: function (cname, cvalue, exdays) {
		        var d = new Date();
		        d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
		        var expires = "expires=" + d.toUTCString();
		        console.info(cname + "=" + cvalue + "; " + expires);
		        document.cookie = cname + "=" + cvalue + "; " + expires;
		        console.info(document.cookie);
			},
			
			getCookie: function (cname) {
		        var name = cname + "=";
		        var ca = document.cookie.split(';');
				console.log(ca)
		        console.log("获取cookie,现在循环")
		        for (var i = 0; i < ca.length; i++) {
		          var c = ca[i];
		          console.log(c)
		          while (c.charAt(0) == ' ') c = c.substring(1);
		          if (c.indexOf(name) != -1){
		            return c.substring(name.length, c.length);
		          }
		        }
		        return "";
      		},
      		
      		 clearCookie: function (username) {
        		this.setCookie(username, "", -1);
      		},
      		
      		
		    checkCookie: function (key) {
		        var user = this.getCookie(key);
		        if (user == "" || user == null) {
		            alert("请登录！")
		            window.location.href = projectName + "/index.html";
		    	}else{
					this.userId = user-1+1
					this.userName = this.getCookie('userName');
					this.phone = this.getCookie('phone');
		    	}
		    },
		    
		    logout: function (){
		    	this.clearCookie("user");
		    	this.checkCookie("user");
		    },
		    // todo 跨域有问题
		    imageUpload: function(){
		    	var _this = this;
		    	var dir = _this.oldDirId[_this.oldDirId.length-1];
		        var file = document.getElementById("file");  
		        var ssFile = document.getElementById("ssFile");  
		            ssFile.value = file.value.substring(12);    //取出文件名，并赋值回显到文本框，用于向后台传文件名
					document.domain = location.hostname;//添加
		            $.ajaxFileUpload({
		                    url: ___Path +  '/file/uploadFile.json?id='+dir.id, //用于文件上传的服务器端请求地址
		                    secureuri: false, //是否需要安全协议，一般设置为false
		                    fileElementId: 'file', //文件上传域的ID
		                    dataType: 'jsonp', //返回值类型 一般设置为json
		                    success: function (data)  //服务器成功响应处理函数
		                    {
		                    	// alert(data.msg);
		                    	_this.getFD(_this.oldDirId[_this.oldDirId.length-1].id,2);
		                    	$('#exampleModa3').modal('hide');
		                    },
		                    error: function (err)//服务器响应失败处理函数
		                    {
		                        alert('上传成功！');
								_this.getFD(_this.oldDirId[_this.oldDirId.length-1].id,2);
								$('#exampleModa3').modal('hide');
								// console.log(err)
		                    }
		                }
		            )
		    }
		}
});
	
	vm.checkCookie("user");
	
	//补0操作,当时间数据小于10的时候，给该数据前面加一个0  
    function getzf(num){  
        if(parseInt(num) < 10){  
            num = '0'+num;  
        }  
        return num;  
    }
	//将时间戳格式化 
	function getMyDate(time){  
    if(typeof(time)=="undefined"){
        return "";
    }
    var oDate = new Date(time),  
     oYear = oDate.getFullYear(),  
     oMonth = oDate.getMonth()+1,  
     oDay = oDate.getDate(),  
     oHour = oDate.getHours(),  
     oMin = oDate.getMinutes(),  
     oSen = oDate.getSeconds(),  
     oTime = oYear +'-'+ getzf(oMonth) +'-'+ getzf(oDay) +' '+ getzf(oHour) +':'+ getzf(oMin) +':'+getzf(oSen);//最后拼接时间  
            
     return oTime;  
    };
    
    //换色
    change = function(obj,flag){
    	var imgName = obj.src.slice(0,-4);
    	var imgPrefix = obj.src.slice(-3);
    	if(flag == 1){
    		obj.src = imgName + '1' + '.' + imgPrefix;
    		$(obj).next().css('color','red');
    	}else{
    		obj.src = imgName.slice(0,-1) + '.' + imgPrefix;
    		$(obj).next().css('color','black');
    	}
    }
    
    
    
</script>